<div class="maintop">
    当前位置：白名单管理
    <a href="javascript:;" action="<?=$basepath?>?<?=$this->page_url($page_current,$page_url)?>" id="btn_refresh" class="mainFrame button">刷新</a>
    <? if(ISDEBUG){ ?>
        <a href="javascript:$('.debuginfo').toggle();" class="button">调试信息</a>
    <? } ?>
</div>
<div class="main-search">
    <table width="100%">

        <tbody><tr>
            <td>
                <form action="<?=$basepath?>" id="brandsSearch" method="get" target="ajax" dataType="html" onajax="beforeSearchForm" call="searchForm" container="#iframe" isLoad="true">
                    <select name="liqtype" style="width:80px">
                        <option value="">全部房间</option>
                        <?php
                        foreach ($rooms as $k=>$v){
                            echo '<option value="',$k,'">',$v,'</option>';
                        }
                        ?>
                    </select>
                    <input type="text" id="sKey" name="sKey" class="int" placeholder="用户号码">
                    <input type="submit" value="搜索" class="upbutton">
                </form>
            </td>
        </tr>
        </tbody>

    </table>
</div>
<div id="mainbody">
    <table width="100%" class="tablist">
        <tr class="trbg">
            <th>玩家</th>
            <th>聊天室</th>
            <th width="40">操作</th>
        </tr>
        <? foreach($datas as $v){ ?>
            <tr>
                <td><?=$v['uno']?> - <?=$v['nickname']?></td>
                <td><?=$v['name']?>(<?=$v['roomid']?>)</td>
                <td>
                    <a href="<?=$basepath?>_delete?uno=<?=$v['uno']?>&roomid=<?=$v['roomid']?>&roomname=<?=$rooms[$v['roomid']]?>" title="删除" class="button icon-trash-2" target="ajax" func="loadpage"></a>
                </td>
            </tr>
        <? } ?>
    </table>
    <? require VIEW.'/page.view.php' ?>
</div>
<script type="text/javascript">
    function beforeSearchForm(){
        var _key = this.sKey.value;
        if(_key.length<=0){
            //throw '搜索关键字不能为空';
        }
    }
    function searchForm(self, _html, data){
        $("#iframe").html(_html);
    }
    $(document).ready(function(){
        <?php
        if(!empty($searchdata['sKey'])){
            echo '$("#sKey").val("'.$searchdata['sKey'].'");';
        }
        if(!empty($searchdata['fromTime'])){
            echo '$("input[name=fromTime]").val("'.$searchdata['fromTime'].'");';
        }
        if(!empty($searchdata['toTime'])){
            echo '$("input[name=toTime]").val("'.$searchdata['toTime'].'");';
        }
        if(!empty($searchdata['liqtype'])){
            echo '$("select[name=\'liqtype\'] option[value=\''.$searchdata['liqtype'].'\']").attr("selected", "selected");';
        }
        if(!empty($searchdata['field'])){
            echo '$("select[name=\'field\'] option[value=\''.$searchdata['field'].'\']").attr("selected", "selected");';
        }
        ?>

    });
</script>
